home *** CD-ROM | disk | FTP | other *** search
- /* $Header: C:/SRC/MOUSE/PVCS/MOUSE.C_V 1.1 12 Jun 1989 21:36:54 $
- Dwight N. Tovey (Adapted from the May/June 1988 issue of TURBO TECHNIX.)
- -----------------------------------------------------------------------------
-
- $Log: C:/SRC/MOUSE/PVCS/MOUSE.C_V $
- /*
- /* Rev 1.1 12 Jun 1989 21:36:54
- /* Corrected minor typos.
- /*
- /*
- /* Rev 1.0 22 May 1989 13:57:50
- /* Initial revision.
- */
-
- #include "mouse.h"
-
- /* STATIC REGISTERS USED THROUGHOUT */
- union REGS m_inreg, m_outreg;
-
- /* Define int for mouse device driver */
- #define callMDD int86( 0x33, &m_inreg, &m_outreg )
-
-
- /****** M __ R E S E T ******/
- resetRec *m_reset()
- {
- static resetRec M;
-
- m_inreg.x.ax = 0; /* Function 0. */
- callMDD;
- M.exists = m_outreg.x.ax;
- M.nButtons = m_outreg.x.bx;
- return( &M );
- }
-
- /****** M __ S H O W ******/
- void m_show( void )
- {
- m_inreg.x.ax = 1; /* Function 1. */
- callMDD;
- }
-
- /****** M __ H I D E ******/
- void m_hide( void )
- {
- m_inreg.x.ax = 2; /* Function 2. */
- callMDD;
- }
-
- /****** M __ P O S ******/
- LocRec *m_pos( void )
- {
- static LocRec M;
-
- m_inreg.x.ax = 3; /* Function 3. */
- callMDD;
- M.buttonStatus = m_outreg.x.bx;
- M.column = m_outreg.x.cx;
- M.row = m_outreg.x.dx;
- return( &M );
- }
-
- /****** M __ M O V E T O ******/
- void m_moveto( int newCol, int newRow )
- {
- m_inreg.x.ax = 4; /* Function 4. */
- m_inreg.x.cx = newCol;
- m_inreg.x.dx = newRow;
- callMDD;
- }
-
- /****** M __ P R E S S E D ******/
- LocRec *m_pressed( int button)
- {
- static LocRec M;
-
- m_inreg.x.ax = 5; /* Function 5. */
- m_inreg.x.bx = button; /* Request for specific button. */
- callMDD;
- M.buttonStatus = m_outreg.x.ax;
- M.opCount = m_outreg.x.bx;
- M.column = m_outreg.x.cx;
- M.row = m_outreg.x.dx;
- return( &M );
- }
-
- /****** M __ R E L E A S E D ******/
- LocRec *m_released( int button )
- {
- static LocRec M;
-
- m_inreg.x.ax = 6; /* Function 6. */
- m_inreg.x.bx = button; /* Request for specific button. */
- callMDD;
- M.buttonStatus = m_outreg.x.ax;
- M.opCount = m_outreg.x.bx;
- M.column = m_outreg.x.cx;
- M.row = m_outreg.x.dx;
- return( &M );
- }
-
- /****** M __ C O L __ R A N G E ******/
- void m_col_range( int hmin, int hmax )
- {
- m_inreg.x.ax = 7; /* Function 7. */
- m_inreg.x.cx = hmin;
- m_inreg.x.dx = hmax;
- callMDD;
- }
-
- /****** M __ R O W __ R A N G E ******/
- void m_row_range( int vmin, int vmax )
- {
- m_inreg.x.ax = 8; /* Function 8. */
- m_inreg.x.cx = vmin;
- m_inreg.x.dx = vmax;
- callMDD;
- }
-
- /****** M __ G R A P H __ C U R S O R ******/
- void m_graph_cursor( int hHot, int vHot, unsigned maskSeg, unsigned maskOfs )
- {
- struct SREGS seg;
-
- m_inreg.x.ax = 9; /* Function 9. */
- m_inreg.x.bx = hHot; /* Cursor hot spot: horizontal. */
- m_inreg.x.cx = vHot; /* Cursor hot spot: vertical. */
- m_inreg.x.dx = maskOfs;
- seg.es = maskSeg;
- int86x( 0x33, &m_inreg, &m_outreg, &seg );
- }
-
- /****** M __ T E X T __ C U R S O R ******/
- void m_text_cursor( int curstype, unsigned arg1, unsigned arg2 )
- {
- m_inreg.x.ax = 10; /* Function 10. */
- m_inreg.x.bx = curstype;
- m_inreg.x.cx = arg1;
- m_inreg.x.dx = arg2;
- callMDD;
- }
-
- /****** M __ M O T I O N ******/
- moveRec *m_motion( void )
- {
- static moveRec M;
-
- m_inreg.x.ax = 11; /* Function 11. */
- callMDD;
- M.hCount = m_outreg.x.cx; /* Net horizontal. */
- M.vCount = m_outreg.x.dx; /* Net vertical. */
- return( &M );
- }
-
- /****** M __ I N S T __ T A S K ******/
- void m_inst_task( unsigned mask, unsigned taskSeg, unsigned taskOfs )
- {
- struct SREGS seg;
-
- m_inreg.x.ax = 12; /* Function 12. */
- m_inreg.x.cx = mask;
- m_inreg.x.dx = taskOfs;
- seg.es = taskSeg;
-
- int86x( 0x33, &m_inreg, &m_outreg, &seg );
- }
-
- /****** M __ L P E N __ O N ******/
- void m_lpen_on( void )
- {
- m_inreg.x.ax = 13; /* Function 13. */
- callMDD;
- }
-
- /****** M __ L P E N __ O F F ******/
- void m_lpen_off( void )
- {
- m_inreg.x.ax = 14; /* Function 14. */
- callMDD;
- }
-
- /****** M __ R A T I O ******/
- void m_ratio( int horiz, int vert )
- {
- m_inreg.x.ax = 15; /* Function 15. */
- m_inreg.x.cx = horiz;
- m_inreg.x.dx = vert;
- callMDD;
- }
-